package com.zuimei.zuimei.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.zuimei.zuimei.R;
import com.zuimei.zuimei.activities.EveryXQingActivity;
import com.zuimei.zuimei.base.BaseFragment;
import com.zuimei.zuimei.beans.EveryDBean;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by pc on 2017/1/18.
 */
public class EveryDXQFragment extends BaseFragment implements View.OnClickListener {

    @Bind(R.id.tv_ed_title)
    TextView tvEdTitle;
    @Bind(R.id.tv_ed_sub)
    TextView tvEdSub;
    @Bind(R.id.iv_ed)
    ImageView ivEd;
    @Bind(R.id.tv_ed_content)
    TextView tvEdContent;
    @Bind(R.id.bt_ed_cont)
    Button btEdCont;
    @Bind(R.id.linear_ed_all)
    LinearLayout linearEdAll;
    private EveryDBean.DataBean.AppsBean bean;

    @Override
    public int getLayoutId() {
        return R.layout.eveyday_vpager_content;
    }

    @Override
    public void init() {
        linearEdAll.setOnClickListener(this);
        bean = (EveryDBean.DataBean.AppsBean) getArguments().getSerializable("data");
        tvEdTitle.setText(bean.getTitle());
        tvEdSub.setText(bean.getSub_title());
        tvEdContent.setText(bean.getDigest());
        btEdCont.setText(bean.getUp_users().size()+"");
        Picasso.with(getContext()).load(bean.getCover_image()).into(ivEd);
    }

    @Override
    public void onClick(View view) {
        Intent intent=new Intent(getContext(),EveryXQingActivity.class);
        intent.putExtra("bean",bean);
        startActivity(intent);
    }
}
